{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "US5z5CfdT0BI"
   },
   "source": [
    "# ArthurBench: Specificity Demo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "id": "VWMGAyfHT0BK"
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "\n",
    "from arthur_bench.run.testsuite import TestSuite\n",
    "\n",
    "pd.set_option('display.max_colwidth', None)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "-mZU4QPiYEkF"
   },
   "source": [
    "# Prepare dataset"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "Jkjb5Uga6Wc4"
   },
   "source": [
    "Using subset of 25 examples from \"Explain like im Five\" subreddit, from Stanford Human Preferences (SHP) Validation dataset. Filtered for `score_ratios` > 2.0."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 264
    },
    "id": "NbBPxz8tT0BK",
    "outputId": "898a470c-c654-48fc-f9aa-5b0bb580d15b"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  <div id=\"df-7439c694-62a7-4b0a-995b-5bf3e8b4cfb1\">\n",
       "    <div class=\"colab-df-container\">\n",
       "      <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history</th>\n",
       "      <th>score_A</th>\n",
       "      <th>score_B</th>\n",
       "      <th>human_ref_A</th>\n",
       "      <th>human_ref_B</th>\n",
       "      <th>labels</th>\n",
       "      <th>score_ratio</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Explain like I'm five years old: Since plastic doesn't biodegrade, why aren't more houses built with plastic instead of wood parts?</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>Structural plastic is softer (weaker) and more expensive (or at least it was until the recent lumber shortage), and it's also susceptible to damage from UV rays in sunlight (plastic exposed to sunlight will become brittle and crack and break). Plastic with additives to deal with the UV are even more expensive.  We do use a lot of plastic in home construction, just not structurally. Plastic sheeting for moisture barrier, plastic water pipes, plastic (or more accurately polymer) electrical junction boxes, plastic (polymer) wire insulation, kitchen cabinet veneers are sometimes made of plastics, etc.</td>\n",
       "      <td>Because heating/cooling your home would be problematic.   I don't want to end up like a leftover in the back of the fridge.</td>\n",
       "      <td>1</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-7439c694-62a7-4b0a-995b-5bf3e8b4cfb1')\"\n",
       "              title=\"Convert this dataframe to an interactive table.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
       "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
       "  </svg>\n",
       "      </button>\n",
       "\n",
       "\n",
       "\n",
       "    <div id=\"df-08cec6bf-faf6-4bd4-8b7a-67cbbc05d1a1\">\n",
       "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-08cec6bf-faf6-4bd4-8b7a-67cbbc05d1a1')\"\n",
       "              title=\"Suggest charts.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "      </button>\n",
       "    </div>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "    background-color: #E8F0FE;\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: #1967D2;\n",
       "    height: 32px;\n",
       "    padding: 0 0 0 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: #E2EBFA;\n",
       "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: #174EA6;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "    background-color: #3B4455;\n",
       "    fill: #D2E3FC;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart:hover {\n",
       "    background-color: #434B5C;\n",
       "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "    fill: #FFFFFF;\n",
       "  }\n",
       "</style>\n",
       "\n",
       "    <script>\n",
       "      async function quickchart(key) {\n",
       "        const containerElement = document.querySelector('#' + key);\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      }\n",
       "    </script>\n",
       "\n",
       "      <script>\n",
       "\n",
       "function displayQuickchartButton(domScope) {\n",
       "  let quickchartButtonEl =\n",
       "    domScope.querySelector('#df-08cec6bf-faf6-4bd4-8b7a-67cbbc05d1a1 button.colab-df-quickchart');\n",
       "  quickchartButtonEl.style.display =\n",
       "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "}\n",
       "\n",
       "        displayQuickchartButton(document);\n",
       "      </script>\n",
       "      <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      flex-wrap:wrap;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "      <script>\n",
       "        const buttonEl =\n",
       "          document.querySelector('#df-7439c694-62a7-4b0a-995b-5bf3e8b4cfb1 button.colab-df-convert');\n",
       "        buttonEl.style.display =\n",
       "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "        async function convertToInteractive(key) {\n",
       "          const element = document.querySelector('#df-7439c694-62a7-4b0a-995b-5bf3e8b4cfb1');\n",
       "          const dataTable =\n",
       "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                     [key], {});\n",
       "          if (!dataTable) return;\n",
       "\n",
       "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "            + ' to learn more about interactive tables.';\n",
       "          element.innerHTML = '';\n",
       "          dataTable['output_type'] = 'display_data';\n",
       "          await google.colab.output.renderOutput(dataTable, element);\n",
       "          const docLink = document.createElement('div');\n",
       "          docLink.innerHTML = docLinkHtml;\n",
       "          element.appendChild(docLink);\n",
       "        }\n",
       "      </script>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "                                                                                                                               history  \\\n",
       "0  Explain like I'm five years old: Since plastic doesn't biodegrade, why aren't more houses built with plastic instead of wood parts?   \n",
       "\n",
       "   score_A  score_B  \\\n",
       "0        9        3   \n",
       "\n",
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    human_ref_A  \\\n",
       "0  Structural plastic is softer (weaker) and more expensive (or at least it was until the recent lumber shortage), and it's also susceptible to damage from UV rays in sunlight (plastic exposed to sunlight will become brittle and crack and break). Plastic with additives to deal with the UV are even more expensive.  We do use a lot of plastic in home construction, just not structurally. Plastic sheeting for moisture barrier, plastic water pipes, plastic (or more accurately polymer) electrical junction boxes, plastic (polymer) wire insulation, kitchen cabinet veneers are sometimes made of plastics, etc.   \n",
       "\n",
       "                                                                                                                   human_ref_B  \\\n",
       "0  Because heating/cooling your home would be problematic.   I don't want to end up like a leftover in the back of the fridge.   \n",
       "\n",
       "   labels  score_ratio  \n",
       "0       1          3.0  "
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eli5 = pd.read_csv('/content/eli5_25.csv')\n",
    "\n",
    "eli5.head(1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "tb0ZnoPNT0BM"
   },
   "source": [
    "# Make a test suite"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "K0vCsMnFT0BM",
    "outputId": "9095dd65-0b17-4583-d137-19a65d3f5cc7"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[nltk_data] Downloading package punkt to /root/nltk_data...\n",
      "[nltk_data]   Unzipping tokenizers/punkt.zip.\n",
      "[nltk_data] Downloading package averaged_perceptron_tagger to\n",
      "[nltk_data]     /root/nltk_data...\n",
      "[nltk_data]   Unzipping taggers/averaged_perceptron_tagger.zip.\n"
     ]
    }
   ],
   "source": [
    "suite_spec = TestSuite(\n",
    "    name='specificity',\n",
    "    scoring_method='specificity',\n",
    "    reference_data=eli5,\n",
    "    input_column='history'\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "wzUeHjmdT0BM"
   },
   "source": [
    "# Run the tests\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "max-XpsUT0BM",
    "outputId": "d7d26613-796a-4308-eac7-0461634e2de0",
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "625it [00:00, 1228.29it/s]\n"
     ]
    }
   ],
   "source": [
    "run_A = suite_spec.run(\n",
    "    run_name=\"A\",\n",
    "    candidate_data=eli5,\n",
    "    candidate_column='human_ref_A'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "ONhf_64R8cCx",
    "outputId": "3c7be555-2bf2-44c7-ac54-866b070c621a"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "625it [00:00, 3455.35it/s]\n"
     ]
    }
   ],
   "source": [
    "run_B = suite_spec.run(\n",
    "    run_name=\"B\",\n",
    "    candidate_data=eli5,\n",
    "    candidate_column='human_ref_B'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "HBEByv_HXaWT",
    "outputId": "9ab985e2-df0b-4551-9345-dfd023ebaac9"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "25 25\n"
     ]
    }
   ],
   "source": [
    "A_scores = []\n",
    "for t in run_A.test_cases:\n",
    "    A_scores.append(t.score)\n",
    "\n",
    "B_scores = []\n",
    "for t in run_B.test_cases:\n",
    "    B_scores.append(t.score)\n",
    "\n",
    "print(len(A_scores), len(B_scores))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "JekDPRyP85Ju"
   },
   "source": [
    "## Compare to LLM Grading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "jdALWI47IWOB"
   },
   "outputs": [],
   "source": [
    "#run llm scorer\n",
    "import os\n",
    "os.environ['OPENAI_API_KEY'] = \"\"##fill in\n",
    "from langchain.chains import LLMChain\n",
    "from langchain.chat_models import ChatOpenAI\n",
    "from langchain.prompts.chat import ChatPromptTemplate, SystemMessagePromptTemplate, AIMessagePromptTemplate, HumanMessagePromptTemplate, BasePromptTemplate\n",
    "import openai\n",
    "import time\n",
    "from tqdm import tqdm"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "sE8rCRmxIWK6"
   },
   "outputs": [],
   "source": [
    "#prompt - from https://github.com/i-Eval/FairEval/blob/main/FairEval.py\n",
    "\n",
    "system_message_prompt = SystemMessagePromptTemplate.from_template(\n",
    "  \"You are a helpful and precise assistant for checking the helpfulness of an answer to a specific prompt.\"\n",
    "  \"\"\"We would like to request your feedback on the helpfulness of 2 responses to the PROMPT.\n",
    "    Please rate the helpfulness, as measured by how useful, relevant and the level of details of the responses.\n",
    "\n",
    "    Each response receives an overall score on a scale of 1 to 10, where a higher score indicates better overall performance.\n",
    "    Please first provide a comprehensive explanation of your evaluation, avoiding any potential bias and ensuring that the order in which the responses were presented does not affect your judgment.\n",
    "    Then, output two lines indicating the scores for Response 1 and 2, respectively.\n",
    "\n",
    "    Output with the following format:\n",
    "\n",
    "    Evaluation evidence: <your evluation explanation here>\n",
    "    Score of the Response 1: <score>\n",
    "    Score of the Response 2: <score>\"\"\"\n",
    ")\n",
    "\n",
    "comparison_template = HumanMessagePromptTemplate.from_template(\n",
    "    \"\"\"\n",
    "    PROMPT: {prompt}\n",
    "    Response 1: {response_1}\n",
    "    The end of Response 1.\n",
    "    ----\n",
    "    Response 2: {response_2}\n",
    "    The end of Response 2.\n",
    "    \"\"\"\n",
    ")\n",
    "\n",
    "llm_evaluate = ChatPromptTemplate.from_messages([system_message_prompt, comparison_template])\n",
    "llmchain= LLMChain(llm=ChatOpenAI(temperature=0, max_tokens=512), prompt=llm_evaluate)\n",
    "\n",
    "def query(prompt, response_1, response_2):\n",
    "    for i in range(4): #max API RETRY\n",
    "        try:\n",
    "            response = llmchain({\"prompt\": prompt, \"response_1\": response_1, \"response_2\": response_2})[\"text\"]\n",
    "            return response\n",
    "        except openai.error.RateLimitError:\n",
    "            print('rate limit')\n",
    "            time.sleep(30)\n",
    "        except Exception as e:\n",
    "            print('error')\n",
    "    raise RuntimeError(f\"Failed after 4 retries.\")\n",
    "\n",
    "def parse_score_from_review(review):\n",
    "    try:\n",
    "        score1 = review.split(\"\\n\")[-2]\n",
    "        score2 = review.split(\"\\n\")[-1]\n",
    "        score1 = score1.split(\":\")[-1].strip()\n",
    "        score2 = score2.split(\":\")[-1].strip()\n",
    "        return [float(score1), float(score2)]\n",
    "    except:\n",
    "        print(f'Failed to parse scores from {review}')\n",
    "        return [-1, -1]\n",
    "\n",
    "def get_scores(prompts, responses_1, responses_2):\n",
    "    llm_score_1= []\n",
    "    llm_score_2= []\n",
    "    all_scores=[]\n",
    "    for i in tqdm(range(len(prompts))):\n",
    "        score_1a, score_2a= parse_score_from_review(query(prompts[i], responses_1[i], responses_2[i]))\n",
    "        score_2b, score_1b = parse_score_from_review(query(prompts[i], responses_2[i], responses_1[i]))\n",
    "        all_scores.append([score_1a, score_1b, score_2a, score_2b])\n",
    "        score_1 = (score_1a + score_1b)/2\n",
    "        score_2 = (score_2a + score_2b)/2\n",
    "        llm_score_1.append(score_1)\n",
    "        llm_score_2.append(score_2)\n",
    "    return llm_score_1, llm_score_2, all_scores"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "M-u3vKJ7IWCT"
   },
   "outputs": [],
   "source": [
    "p= eli5['history'].values\n",
    "r1=eli5['human_ref_A'].values\n",
    "r2=eli5['human_ref_B'].values\n",
    "\n",
    "llm_score_1, llm_score_2, all_scores = get_scores(p, r1, r2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "id": "PPQVv_qRIV3A"
   },
   "outputs": [],
   "source": [
    "def assign_label(A,B):\n",
    "  #it is 1 if A is preferred to B; 0 if B is preferred to A, 0.5 if it is a tie - according to SHP rules\n",
    "  if A>B:\n",
    "    return 1\n",
    "  elif B>A:\n",
    "    return 0\n",
    "  else:\n",
    "    return 0.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 871
    },
    "id": "Kwxf0XnYIV59",
    "outputId": "2fd7dca0-afd4-4761-d41c-938bb2e813a4"
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  <div id=\"df-f78c0f92-b0f3-444a-bf7d-b3f00d4f124c\">\n",
       "    <div class=\"colab-df-container\">\n",
       "      <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history</th>\n",
       "      <th>score_A</th>\n",
       "      <th>score_B</th>\n",
       "      <th>human_ref_A</th>\n",
       "      <th>human_ref_B</th>\n",
       "      <th>labels</th>\n",
       "      <th>score_ratio</th>\n",
       "      <th>llm_score_A</th>\n",
       "      <th>llm_score_B</th>\n",
       "      <th>llm_pref</th>\n",
       "      <th>human_llm_match</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Explain like I'm five years old: Since plastic doesn't biodegrade, why aren't more houses built with plastic instead of wood parts?</td>\n",
       "      <td>9</td>\n",
       "      <td>3</td>\n",
       "      <td>Structural plastic is softer (weaker) and more expensive (or at least it was until the recent lumber shortage), and it's also susceptible to damage from UV rays in sunlight (plastic exposed to sunlight will become brittle and crack and break). Plastic with additives to deal with the UV are even more expensive.  We do use a lot of plastic in home construction, just not structurally. Plastic sheeting for moisture barrier, plastic water pipes, plastic (or more accurately polymer) electrical junction boxes, plastic (polymer) wire insulation, kitchen cabinet veneers are sometimes made of plastics, etc.</td>\n",
       "      <td>Because heating/cooling your home would be problematic.   I don't want to end up like a leftover in the back of the fridge.</td>\n",
       "      <td>1</td>\n",
       "      <td>3.0</td>\n",
       "      <td>8.5</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1.0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-f78c0f92-b0f3-444a-bf7d-b3f00d4f124c')\"\n",
       "              title=\"Convert this dataframe to an interactive table.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
       "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
       "  </svg>\n",
       "      </button>\n",
       "\n",
       "\n",
       "\n",
       "    <div id=\"df-7f166807-893b-448e-a976-d9fee9251113\">\n",
       "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-7f166807-893b-448e-a976-d9fee9251113')\"\n",
       "              title=\"Suggest charts.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "      </button>\n",
       "    </div>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "    background-color: #E8F0FE;\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: #1967D2;\n",
       "    height: 32px;\n",
       "    padding: 0 0 0 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: #E2EBFA;\n",
       "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: #174EA6;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "    background-color: #3B4455;\n",
       "    fill: #D2E3FC;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart:hover {\n",
       "    background-color: #434B5C;\n",
       "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "    fill: #FFFFFF;\n",
       "  }\n",
       "</style>\n",
       "\n",
       "    <script>\n",
       "      async function quickchart(key) {\n",
       "        const containerElement = document.querySelector('#' + key);\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      }\n",
       "    </script>\n",
       "\n",
       "      <script>\n",
       "\n",
       "function displayQuickchartButton(domScope) {\n",
       "  let quickchartButtonEl =\n",
       "    domScope.querySelector('#df-7f166807-893b-448e-a976-d9fee9251113 button.colab-df-quickchart');\n",
       "  quickchartButtonEl.style.display =\n",
       "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "}\n",
       "\n",
       "        displayQuickchartButton(document);\n",
       "      </script>\n",
       "      <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      flex-wrap:wrap;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "      <script>\n",
       "        const buttonEl =\n",
       "          document.querySelector('#df-f78c0f92-b0f3-444a-bf7d-b3f00d4f124c button.colab-df-convert');\n",
       "        buttonEl.style.display =\n",
       "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "        async function convertToInteractive(key) {\n",
       "          const element = document.querySelector('#df-f78c0f92-b0f3-444a-bf7d-b3f00d4f124c');\n",
       "          const dataTable =\n",
       "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                     [key], {});\n",
       "          if (!dataTable) return;\n",
       "\n",
       "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "            + ' to learn more about interactive tables.';\n",
       "          element.innerHTML = '';\n",
       "          dataTable['output_type'] = 'display_data';\n",
       "          await google.colab.output.renderOutput(dataTable, element);\n",
       "          const docLink = document.createElement('div');\n",
       "          docLink.innerHTML = docLinkHtml;\n",
       "          element.appendChild(docLink);\n",
       "        }\n",
       "      </script>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "                                                                                                                               history  \\\n",
       "0  Explain like I'm five years old: Since plastic doesn't biodegrade, why aren't more houses built with plastic instead of wood parts?   \n",
       "\n",
       "   score_A  score_B  \\\n",
       "0        9        3   \n",
       "\n",
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    human_ref_A  \\\n",
       "0  Structural plastic is softer (weaker) and more expensive (or at least it was until the recent lumber shortage), and it's also susceptible to damage from UV rays in sunlight (plastic exposed to sunlight will become brittle and crack and break). Plastic with additives to deal with the UV are even more expensive.  We do use a lot of plastic in home construction, just not structurally. Plastic sheeting for moisture barrier, plastic water pipes, plastic (or more accurately polymer) electrical junction boxes, plastic (polymer) wire insulation, kitchen cabinet veneers are sometimes made of plastics, etc.   \n",
       "\n",
       "                                                                                                                   human_ref_B  \\\n",
       "0  Because heating/cooling your home would be problematic.   I don't want to end up like a leftover in the back of the fridge.   \n",
       "\n",
       "   labels  score_ratio  llm_score_A  llm_score_B  llm_pref  human_llm_match  \n",
       "0       1          3.0          8.5          2.5       1.0             True  "
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "llm_scores= pd.read_csv('/content/llm_scores_specificity.csv')\n",
    "llm_scores.head(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "42cg1CZpNyQT",
    "outputId": "a427d00d-3e1d-4e62-c89c-45f888ab9aa2"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True     13\n",
       "False    12\n",
       "Name: human_llm_match, dtype: int64"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "llm_scores['human_llm_match'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "id": "WmCbIJW87xb3"
   },
   "outputs": [],
   "source": [
    "full_scores = llm_scores.copy()\n",
    "\n",
    "full_scores['spec_score_A'] = A_scores\n",
    "full_scores['spec_score_B'] = B_scores\n",
    "full_scores['spec_pref'] = full_scores.apply(lambda x: assign_label(x['spec_score_A'], x['spec_score_B']), axis=1)\n",
    "\n",
    "full_scores['human_spec_match']= full_scores['labels']==full_scores['spec_pref']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "HoNA0HhuNxzJ",
    "outputId": "cfd39929-264f-40e3-abd0-7f09f41d6926"
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True     19\n",
       "False     6\n",
       "Name: human_spec_match, dtype: int64"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "full_scores['human_spec_match'].value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 1000
    },
    "id": "SlPt622pIVqY",
    "outputId": "b5fc307d-e1e1-43a0-eaa7-dad92ef6a23b"
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-35-d2c32916083b>:1: UserWarning: Boolean Series key will be reindexed to match DataFrame index.\n",
      "  full_scores[full_scores.human_spec_match == True][full_scores.human_llm_match == False]\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "\n",
       "\n",
       "  <div id=\"df-c10a4950-eb37-4d90-8525-db69c7961176\">\n",
       "    <div class=\"colab-df-container\">\n",
       "      <div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>history</th>\n",
       "      <th>score_A</th>\n",
       "      <th>score_B</th>\n",
       "      <th>human_ref_A</th>\n",
       "      <th>human_ref_B</th>\n",
       "      <th>labels</th>\n",
       "      <th>score_ratio</th>\n",
       "      <th>llm_score_A</th>\n",
       "      <th>llm_score_B</th>\n",
       "      <th>llm_pref</th>\n",
       "      <th>human_llm_match</th>\n",
       "      <th>spec_score_A</th>\n",
       "      <th>spec_score_B</th>\n",
       "      <th>spec_pref</th>\n",
       "      <th>human_spec_match</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Eli5 How exactly does Noise cancellation work? That too in such small airbuds</td>\n",
       "      <td>948</td>\n",
       "      <td>5</td>\n",
       "      <td>You know how your headphones can reproduce any sound? Noise cancelling headphones have microphones to detect what outside sounds you're about to hear and then make the exact opposite sound at exactly the right time. Any sound (no matter how complex or loud) + its exact opposite = no sound at all, much like 5 + (-5) = 0.  I could get into superposition and all that, but that's probably beyond age 5.</td>\n",
       "      <td>The sound you hear is a wave that is a sum of all sounds around you. Waves have a few relevant properties: They travel at a known velocity, and they are additive.  To cancel such wave in your ear: we measure the wave just outside the ear and play its inverse with a small delay from the earphone. Notably, this only cancels the sound in a very small region around the inner side of the earphone. Everywhere else it adds its miniscule amount of more sound to the wave.  For best results: You need a good microphone in both earphones, and a good algorithm to slightly alter the wave, to mimic hiw it will be altered by the earlobe (as the in-ear earphone sound is not altered by the earlobe identically to the sound coming from the outside). Fortunately, we can tune this individually: place a second microphone inside each ear canal (near the very tip of the earphone), and measure which delay and which amplitude modifications reduce the sound the most.  A good analogue: Look at the waves in the see. Measure the height of the wave. If it is above the mean water level, push the water down with a paddle you have placed under the surface. If it is below, push the water up. If you move your paddle at just the right speed for a given measurement, you can destroy the wave around your paddle (whilst creating a new wave around your paddle, propagating outwards and adding a bit to the waves everywhere else in the sea).</td>\n",
       "      <td>1</td>\n",
       "      <td>189.600000</td>\n",
       "      <td>6.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.506020</td>\n",
       "      <td>0.426907</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Explain like I'm five years old how is the US banking system not crippled by credit card fraud? I come from a country where most people don't have a credit card.  I cannot wrap my head around this documentary.  Now I get that credit card fraud *is* a big problem.  But if all you need is the card number to order stuff, and card numbers are so easy to come by as shown in the documentary, then why is not every single criminal in the US running a credit card fraud operation?  It seems super easy and low risk. Get a burner device, order stuff from public wifi, and don't be stupid about the delivery locations.</td>\n",
       "      <td>30</td>\n",
       "      <td>114</td>\n",
       "      <td>I mean, you also have to remember that this particular scam was from back in the late '80s and early '90s.  Banks have gotten *considerably* better at detecting fraudulent charges now, and even for the charges that slip through the total amount of money lost is pretty insignificant.</td>\n",
       "      <td>OP that documentary is from 1992. Banking and Credit Systems have evolved substantially in 30 years. You're thinking the entire US banking system is still being ran like its the 1980s.</td>\n",
       "      <td>0</td>\n",
       "      <td>3.800000</td>\n",
       "      <td>8.5</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.544800</td>\n",
       "      <td>0.826140</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Explain like I'm five years old What's so special about water and why is it the most important substance in industrial processes and life on Earth? It's practically used for everything; drinking, cooking, cleaning, chemical reactions, generating electricity and the list goes on...but what makes it so suitable for basically everything?</td>\n",
       "      <td>5</td>\n",
       "      <td>11</td>\n",
       "      <td>Off the top of my head...  Availability and affordability, as it is the most common liquid on the planet.  Being a singular substance, rather than a mix of others, meaning it can be contaminated, but not destroyed, by most processes.  Relatively easy to purify, via filtering, boiling, etc.  Relatively non toxic.  Relatively non compressible as a liquid, which is useful in various applications.  Highly reusable in processes such as steam powered turbines.  I'm sure there are other particular chemical characteristics that make it useful in specific applications.</td>\n",
       "      <td>Water is an excellent solvent, many, many substances can be dissolved by it.  There is a humongous amount of water on the Earth.  As a result, it is one of the least expensive chemicals available.</td>\n",
       "      <td>0</td>\n",
       "      <td>2.200000</td>\n",
       "      <td>8.5</td>\n",
       "      <td>5.5</td>\n",
       "      <td>1.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.513261</td>\n",
       "      <td>0.558839</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Explain like I'm five years old: London's population in 1900 was around 6 million, where did they all live?! I've seen maps of London at around this time and it is tiny compared to what it is now.  Was the population density a lot higher?  Did there used to be taller buildings?  It seems strange to imagine so many people packed into such a small space.  Ty</td>\n",
       "      <td>146</td>\n",
       "      <td>714</td>\n",
       "      <td>Not specific to London, but here in North America population densities were crazy high per square meter of city space vs what we have now.  Like a factor of 20x higher.    Throughout the 1920s several of the 'problematic' city ordinances that urbanists like to hate on came into effect.  They came into effect to effectively ban or break up many of the dwelling that were catering to the underclass.  As an example, there were rooming houses dotted all over where one could rent a mattress on the floor for as little time as a night for what amounted to a couple bucks in today's money.  These houses would be stuffed to full of migrant workers and other assorted poor people.  Basically they were dens of disease, crime and filth and poverty.  They also represent the market providing shelter for the bottom of the barrel and for those who may not have the right skin tone to stay in better accommodations.  So, in parallel with the introduction of the car, the city passed zoning laws that forbade these places.  Now there were max limits to how many people could stay in a dwelling.  This shut down the boarding houses because the landlord can't make a go of it without jacking rates.  (If you can't have 100 people paying a dollar per night, then you need to find one guy to pay 100 per night.)   There were zones that industrial activity could take place and they must be separated from where people lived forcing folks to travel longer distances from home to job.  People use to have 'servant' quarters in their back yard, but banned.    This is kind of a poor explanation, but hopefully it gives some kind of a sense of what happened.  At the end of the day, some of the changes were needed to combat rampant social disorder, but many of the changes were pushed to the extreme in order to try and entirely eliminate the 'undesirable' parts of the population.  The problem has been that we've now created a system that nobody but the rich can afford to live.</td>\n",
       "      <td>They crammed everyone close together. For those homeless/sleeping rough:  Penny sit-up: You could rest sitting on a bench but could not lay down, or really sleep (sleeping wasn't including in the price)  Twopenny hangover: you would sleep hanging over a rope for two pennies  Four-penny coffin: finally some rest laying down packed like sardines, infested with bugs though (so said Orwell)  https://www.historic-uk.com/CultureUK/Two-Penny-Hangover/  This is for Victorian age but it continued into the 20th century (and tbf, so did the Victorian age)</td>\n",
       "      <td>0</td>\n",
       "      <td>4.890411</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>0.5</td>\n",
       "      <td>False</td>\n",
       "      <td>0.486942</td>\n",
       "      <td>0.594562</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Explain like I'm five years old: why is a chip on a credit card considered ‘safer’ than swiping the magnetic strip?</td>\n",
       "      <td>2266</td>\n",
       "      <td>291</td>\n",
       "      <td>The magnetic strip is like a secret code that lets you buy things. I can copy your secret code and use it to buy things.  The chip is like a little man who makes secret codes that can each be used to buy one thing. I can copy the secret code but not the little man. Because the secret code only works once and for a limited time, and in one situation, stealing the secret code isn’t useful. You can’t steal the little man without doing a lot of work.</td>\n",
       "      <td>The chip is actually a tiny computer that is powered by the reader.   It has a secret number inside of it that cannot be read. Only the bank knows the number. There's no way to ask it the secret number. Instead, you can only give it another number, and it will do some math on that number and its secret number and tell you another number. That's what happens when you read the card. The bank picks a number and asks the card to respond. The bank does the same math, and if your card has the same secret number it must be legit.  Now, you're probably thinking someone could figure out the secret number by just getting it to do the math enough times. But the numbers involved are so big, this will take too long to be practical, more than 10 years to get enough numbers to have a shred of making a guess. Even with very modern computers. That's longer than your card's expiration date so it's fine.  And if computers get fast enough the math fails, the banks can simply change the chips to use new algorithms and new, bigger numbers that take even longer to crack.</td>\n",
       "      <td>1</td>\n",
       "      <td>7.786942</td>\n",
       "      <td>6.5</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.500565</td>\n",
       "      <td>0.448071</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Explain like I'm five years old: What exactly is phlegm and why/how does the human body produce so much of it?</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>Mucous is mostly made up of water, and is given its properties by long, grippy protein strands. The protein acts like a mop, but much better. I can hold on to itself very well, along with water, and even more water between the strands. Your body has lots of water, and it takes a very small amount of protein to make mucus. So unless you're severely dehydrated, or on the verge of death by malnutrition, you have an endless supply of phlegm.</td>\n",
       "      <td>Phlegm aka mucus of the respiratory tract is a very useful substance.    First lungs need to be wet so that oxygen can go into the body and carbon dioxide can go out.  Mucus is good for this because it is thick like mayonnaise and won't immediately run down and pool in the bottom of your lungs.  But even a jar of mayonnaise that you have shaken will eventually run down to the bottom of the jar.   So secondly, to avoid this, our respiratory tract is lined with little hairs that can move and paddle the mucus upwards.  This is great because in addition to preventing the mucus from pooling at the bottom of your lungs, it actually paddles the mucus up from your lungs and into your throat where it goes into your stomach.  This leads to the third great thing about mucus because it helps to keep our lungs clean.  All that dust in the air will collect in your lungs much like it collects in your house.  That mucus traps the dust and it is pushed out of your lungs and into your stomach where you can eventually get rid of it by pooping.</td>\n",
       "      <td>1</td>\n",
       "      <td>2.500000</td>\n",
       "      <td>7.5</td>\n",
       "      <td>9.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.445564</td>\n",
       "      <td>0.423027</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>Explain like I'm five years old: If soap breaks down oil, why can’t oil be broken down with soap and then diluted to go down the drain?</td>\n",
       "      <td>128</td>\n",
       "      <td>18</td>\n",
       "      <td>Soap/detergents don't break oil down.  They simply emulsify it, or hold it in suspension.  It is still 100% oil, just distributed differently... in the water rather than on the water.</td>\n",
       "      <td>It can, and is, all the time.  Do you ever wash your dishes?  Wash a pan you cooked with?  When you do that, you use dish soap, and then the soap helps break down the oils, and washes down the drain.    If you've ever worked on a car and got your hands all greasy, then you go inside and you use hot water and soap and you wash your hands really good, all those oils go down your drain.  Where you run into problems, is when people pour oil and grease down their drain.  Because it's not diluted enough, and it will then solidify in your pipes and cause them to clog.  Then you pay big bucks to have it fixed.</td>\n",
       "      <td>1</td>\n",
       "      <td>7.111111</td>\n",
       "      <td>5.5</td>\n",
       "      <td>8.5</td>\n",
       "      <td>0.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.586834</td>\n",
       "      <td>0.432945</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Explain like I'm five years old How do chip manufacturers keep their IP from being reversed engineered. How do chip manufacturers keep their IP from being reversed engineered? Is it too difficult for other companies to understand how the chips and boards were made and try to come up with how to make it themselves?</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Reverse engineering the process of how a chip was made is next to impossible. It's like 3D printing at a microscopic level with a plethora of different chemicals, metals and lasers. Then you have to scale and replicate while also having similar precision to what you're trying to copy. You'd have to have detailed data and plans and a lot of them copied, to get something that could be similar. Also lots of money.</td>\n",
       "      <td>I worked at Mostek in the 70s and 80s and we reverse engineered the 8086 and 68000 families.  Our RAM and calculator chips were copied by many others. There was no law against it as copyright only covered the aesthetics and not function.  Congress passed a law allowing copyright of photomask's and that ended it.</td>\n",
       "      <td>0</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>8.5</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.454712</td>\n",
       "      <td>0.661681</td>\n",
       "      <td>0</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Explain like I'm five years old: Why aren't cigarettes/tobacco a \"schedule 1\" drug, if they are scientifically proven to cause hundreds of thousands of deaths each year?</td>\n",
       "      <td>37</td>\n",
       "      <td>3</td>\n",
       "      <td>Scheduling of drugs is not done solely based on the scientific evidence. Political and economic concerns play a role.</td>\n",
       "      <td>What 59179 said, but also because it is so widespread and in common usage, trying to limit it outright could lead to huge backlash (think prohibition). The good news is they're slowly phasing it out though, and finally getting more and more regulations in place.</td>\n",
       "      <td>1</td>\n",
       "      <td>12.333333</td>\n",
       "      <td>6.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>False</td>\n",
       "      <td>0.691250</td>\n",
       "      <td>0.443299</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>\n",
       "      <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-c10a4950-eb37-4d90-8525-db69c7961176')\"\n",
       "              title=\"Convert this dataframe to an interactive table.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "       width=\"24px\">\n",
       "    <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
       "    <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
       "  </svg>\n",
       "      </button>\n",
       "\n",
       "\n",
       "\n",
       "    <div id=\"df-8b411a3b-0891-4d6f-8559-a65ee79b6fbd\">\n",
       "      <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-8b411a3b-0891-4d6f-8559-a65ee79b6fbd')\"\n",
       "              title=\"Suggest charts.\"\n",
       "              style=\"display:none;\">\n",
       "\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
       "     width=\"24px\">\n",
       "    <g>\n",
       "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
       "    </g>\n",
       "</svg>\n",
       "      </button>\n",
       "    </div>\n",
       "\n",
       "<style>\n",
       "  .colab-df-quickchart {\n",
       "    background-color: #E8F0FE;\n",
       "    border: none;\n",
       "    border-radius: 50%;\n",
       "    cursor: pointer;\n",
       "    display: none;\n",
       "    fill: #1967D2;\n",
       "    height: 32px;\n",
       "    padding: 0 0 0 0;\n",
       "    width: 32px;\n",
       "  }\n",
       "\n",
       "  .colab-df-quickchart:hover {\n",
       "    background-color: #E2EBFA;\n",
       "    box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "    fill: #174EA6;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart {\n",
       "    background-color: #3B4455;\n",
       "    fill: #D2E3FC;\n",
       "  }\n",
       "\n",
       "  [theme=dark] .colab-df-quickchart:hover {\n",
       "    background-color: #434B5C;\n",
       "    box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "    fill: #FFFFFF;\n",
       "  }\n",
       "</style>\n",
       "\n",
       "    <script>\n",
       "      async function quickchart(key) {\n",
       "        const containerElement = document.querySelector('#' + key);\n",
       "        const charts = await google.colab.kernel.invokeFunction(\n",
       "            'suggestCharts', [key], {});\n",
       "      }\n",
       "    </script>\n",
       "\n",
       "      <script>\n",
       "\n",
       "function displayQuickchartButton(domScope) {\n",
       "  let quickchartButtonEl =\n",
       "    domScope.querySelector('#df-8b411a3b-0891-4d6f-8559-a65ee79b6fbd button.colab-df-quickchart');\n",
       "  quickchartButtonEl.style.display =\n",
       "    google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "}\n",
       "\n",
       "        displayQuickchartButton(document);\n",
       "      </script>\n",
       "      <style>\n",
       "    .colab-df-container {\n",
       "      display:flex;\n",
       "      flex-wrap:wrap;\n",
       "      gap: 12px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert {\n",
       "      background-color: #E8F0FE;\n",
       "      border: none;\n",
       "      border-radius: 50%;\n",
       "      cursor: pointer;\n",
       "      display: none;\n",
       "      fill: #1967D2;\n",
       "      height: 32px;\n",
       "      padding: 0 0 0 0;\n",
       "      width: 32px;\n",
       "    }\n",
       "\n",
       "    .colab-df-convert:hover {\n",
       "      background-color: #E2EBFA;\n",
       "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
       "      fill: #174EA6;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert {\n",
       "      background-color: #3B4455;\n",
       "      fill: #D2E3FC;\n",
       "    }\n",
       "\n",
       "    [theme=dark] .colab-df-convert:hover {\n",
       "      background-color: #434B5C;\n",
       "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
       "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
       "      fill: #FFFFFF;\n",
       "    }\n",
       "  </style>\n",
       "\n",
       "      <script>\n",
       "        const buttonEl =\n",
       "          document.querySelector('#df-c10a4950-eb37-4d90-8525-db69c7961176 button.colab-df-convert');\n",
       "        buttonEl.style.display =\n",
       "          google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
       "\n",
       "        async function convertToInteractive(key) {\n",
       "          const element = document.querySelector('#df-c10a4950-eb37-4d90-8525-db69c7961176');\n",
       "          const dataTable =\n",
       "            await google.colab.kernel.invokeFunction('convertToInteractive',\n",
       "                                                     [key], {});\n",
       "          if (!dataTable) return;\n",
       "\n",
       "          const docLinkHtml = 'Like what you see? Visit the ' +\n",
       "            '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
       "            + ' to learn more about interactive tables.';\n",
       "          element.innerHTML = '';\n",
       "          dataTable['output_type'] = 'display_data';\n",
       "          await google.colab.output.renderOutput(dataTable, element);\n",
       "          const docLink = document.createElement('div');\n",
       "          docLink.innerHTML = docLinkHtml;\n",
       "          element.appendChild(docLink);\n",
       "        }\n",
       "      </script>\n",
       "    </div>\n",
       "  </div>\n"
      ],
      "text/plain": [
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                history  \\\n",
       "3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Eli5 How exactly does Noise cancellation work? That too in such small airbuds   \n",
       "6   Explain like I'm five years old how is the US banking system not crippled by credit card fraud? I come from a country where most people don't have a credit card.  I cannot wrap my head around this documentary.  Now I get that credit card fraud *is* a big problem.  But if all you need is the card number to order stuff, and card numbers are so easy to come by as shown in the documentary, then why is not every single criminal in the US running a credit card fraud operation?  It seems super easy and low risk. Get a burner device, order stuff from public wifi, and don't be stupid about the delivery locations.   \n",
       "8                                                                                                                                                                                                                                                                                      Explain like I'm five years old What's so special about water and why is it the most important substance in industrial processes and life on Earth? It's practically used for everything; drinking, cooking, cleaning, chemical reactions, generating electricity and the list goes on...but what makes it so suitable for basically everything?   \n",
       "11                                                                                                                                                                                                                                                               Explain like I'm five years old: London's population in 1900 was around 6 million, where did they all live?! I've seen maps of London at around this time and it is tiny compared to what it is now.  Was the population density a lot higher?  Did there used to be taller buildings?  It seems strange to imagine so many people packed into such a small space.  Ty   \n",
       "15                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Explain like I'm five years old: why is a chip on a credit card considered ‘safer’ than swiping the magnetic strip?   \n",
       "17                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Explain like I'm five years old: What exactly is phlegm and why/how does the human body produce so much of it?   \n",
       "18                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Explain like I'm five years old: If soap breaks down oil, why can’t oil be broken down with soap and then diluted to go down the drain?   \n",
       "21                                                                                                                                                                                                                                                                                                          Explain like I'm five years old How do chip manufacturers keep their IP from being reversed engineered. How do chip manufacturers keep their IP from being reversed engineered? Is it too difficult for other companies to understand how the chips and boards were made and try to come up with how to make it themselves?   \n",
       "23                                                                                                                                                                                                                                                                                                                                                                                                                                                            Explain like I'm five years old: Why aren't cigarettes/tobacco a \"schedule 1\" drug, if they are scientifically proven to cause hundreds of thousands of deaths each year?   \n",
       "\n",
       "    score_A  score_B  \\\n",
       "3       948        5   \n",
       "6        30      114   \n",
       "8         5       11   \n",
       "11      146      714   \n",
       "15     2266      291   \n",
       "17        5        2   \n",
       "18      128       18   \n",
       "21        2        4   \n",
       "23       37        3   \n",
       "\n",
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     human_ref_A  \\\n",
       "3                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              You know how your headphones can reproduce any sound? Noise cancelling headphones have microphones to detect what outside sounds you're about to hear and then make the exact opposite sound at exactly the right time. Any sound (no matter how complex or loud) + its exact opposite = no sound at all, much like 5 + (-5) = 0.  I could get into superposition and all that, but that's probably beyond age 5.   \n",
       "6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    I mean, you also have to remember that this particular scam was from back in the late '80s and early '90s.  Banks have gotten *considerably* better at detecting fraudulent charges now, and even for the charges that slip through the total amount of money lost is pretty insignificant.   \n",
       "8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Off the top of my head...  Availability and affordability, as it is the most common liquid on the planet.  Being a singular substance, rather than a mix of others, meaning it can be contaminated, but not destroyed, by most processes.  Relatively easy to purify, via filtering, boiling, etc.  Relatively non toxic.  Relatively non compressible as a liquid, which is useful in various applications.  Highly reusable in processes such as steam powered turbines.  I'm sure there are other particular chemical characteristics that make it useful in specific applications.   \n",
       "11  Not specific to London, but here in North America population densities were crazy high per square meter of city space vs what we have now.  Like a factor of 20x higher.    Throughout the 1920s several of the 'problematic' city ordinances that urbanists like to hate on came into effect.  They came into effect to effectively ban or break up many of the dwelling that were catering to the underclass.  As an example, there were rooming houses dotted all over where one could rent a mattress on the floor for as little time as a night for what amounted to a couple bucks in today's money.  These houses would be stuffed to full of migrant workers and other assorted poor people.  Basically they were dens of disease, crime and filth and poverty.  They also represent the market providing shelter for the bottom of the barrel and for those who may not have the right skin tone to stay in better accommodations.  So, in parallel with the introduction of the car, the city passed zoning laws that forbade these places.  Now there were max limits to how many people could stay in a dwelling.  This shut down the boarding houses because the landlord can't make a go of it without jacking rates.  (If you can't have 100 people paying a dollar per night, then you need to find one guy to pay 100 per night.)   There were zones that industrial activity could take place and they must be separated from where people lived forcing folks to travel longer distances from home to job.  People use to have 'servant' quarters in their back yard, but banned.    This is kind of a poor explanation, but hopefully it gives some kind of a sense of what happened.  At the end of the day, some of the changes were needed to combat rampant social disorder, but many of the changes were pushed to the extreme in order to try and entirely eliminate the 'undesirable' parts of the population.  The problem has been that we've now created a system that nobody but the rich can afford to live.   \n",
       "15                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            The magnetic strip is like a secret code that lets you buy things. I can copy your secret code and use it to buy things.  The chip is like a little man who makes secret codes that can each be used to buy one thing. I can copy the secret code but not the little man. Because the secret code only works once and for a limited time, and in one situation, stealing the secret code isn’t useful. You can’t steal the little man without doing a lot of work.   \n",
       "17                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Mucous is mostly made up of water, and is given its properties by long, grippy protein strands. The protein acts like a mop, but much better. I can hold on to itself very well, along with water, and even more water between the strands. Your body has lots of water, and it takes a very small amount of protein to make mucus. So unless you're severely dehydrated, or on the verge of death by malnutrition, you have an endless supply of phlegm.   \n",
       "18                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Soap/detergents don't break oil down.  They simply emulsify it, or hold it in suspension.  It is still 100% oil, just distributed differently... in the water rather than on the water.   \n",
       "21                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Reverse engineering the process of how a chip was made is next to impossible. It's like 3D printing at a microscopic level with a plethora of different chemicals, metals and lasers. Then you have to scale and replicate while also having similar precision to what you're trying to copy. You'd have to have detailed data and plans and a lot of them copied, to get something that could be similar. Also lots of money.   \n",
       "23                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Scheduling of drugs is not done solely based on the scientific evidence. Political and economic concerns play a role.   \n",
       "\n",
       "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    human_ref_B  \\\n",
       "3   The sound you hear is a wave that is a sum of all sounds around you. Waves have a few relevant properties: They travel at a known velocity, and they are additive.  To cancel such wave in your ear: we measure the wave just outside the ear and play its inverse with a small delay from the earphone. Notably, this only cancels the sound in a very small region around the inner side of the earphone. Everywhere else it adds its miniscule amount of more sound to the wave.  For best results: You need a good microphone in both earphones, and a good algorithm to slightly alter the wave, to mimic hiw it will be altered by the earlobe (as the in-ear earphone sound is not altered by the earlobe identically to the sound coming from the outside). Fortunately, we can tune this individually: place a second microphone inside each ear canal (near the very tip of the earphone), and measure which delay and which amplitude modifications reduce the sound the most.  A good analogue: Look at the waves in the see. Measure the height of the wave. If it is above the mean water level, push the water down with a paddle you have placed under the surface. If it is below, push the water up. If you move your paddle at just the right speed for a given measurement, you can destroy the wave around your paddle (whilst creating a new wave around your paddle, propagating outwards and adding a bit to the waves everywhere else in the sea).   \n",
       "6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      OP that documentary is from 1992. Banking and Credit Systems have evolved substantially in 30 years. You're thinking the entire US banking system is still being ran like its the 1980s.   \n",
       "8                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Water is an excellent solvent, many, many substances can be dissolved by it.  There is a humongous amount of water on the Earth.  As a result, it is one of the least expensive chemicals available.   \n",
       "11                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       They crammed everyone close together. For those homeless/sleeping rough:  Penny sit-up: You could rest sitting on a bench but could not lay down, or really sleep (sleeping wasn't including in the price)  Twopenny hangover: you would sleep hanging over a rope for two pennies  Four-penny coffin: finally some rest laying down packed like sardines, infested with bugs though (so said Orwell)  https://www.historic-uk.com/CultureUK/Two-Penny-Hangover/  This is for Victorian age but it continued into the 20th century (and tbf, so did the Victorian age)   \n",
       "15                                                                                                                                                                                                                                                                                                                                                                     The chip is actually a tiny computer that is powered by the reader.   It has a secret number inside of it that cannot be read. Only the bank knows the number. There's no way to ask it the secret number. Instead, you can only give it another number, and it will do some math on that number and its secret number and tell you another number. That's what happens when you read the card. The bank picks a number and asks the card to respond. The bank does the same math, and if your card has the same secret number it must be legit.  Now, you're probably thinking someone could figure out the secret number by just getting it to do the math enough times. But the numbers involved are so big, this will take too long to be practical, more than 10 years to get enough numbers to have a shred of making a guess. Even with very modern computers. That's longer than your card's expiration date so it's fine.  And if computers get fast enough the math fails, the banks can simply change the chips to use new algorithms and new, bigger numbers that take even longer to crack.   \n",
       "17                                                                                                                                                                                                                                                                                                                                                                                             Phlegm aka mucus of the respiratory tract is a very useful substance.    First lungs need to be wet so that oxygen can go into the body and carbon dioxide can go out.  Mucus is good for this because it is thick like mayonnaise and won't immediately run down and pool in the bottom of your lungs.  But even a jar of mayonnaise that you have shaken will eventually run down to the bottom of the jar.   So secondly, to avoid this, our respiratory tract is lined with little hairs that can move and paddle the mucus upwards.  This is great because in addition to preventing the mucus from pooling at the bottom of your lungs, it actually paddles the mucus up from your lungs and into your throat where it goes into your stomach.  This leads to the third great thing about mucus because it helps to keep our lungs clean.  All that dust in the air will collect in your lungs much like it collects in your house.  That mucus traps the dust and it is pushed out of your lungs and into your stomach where you can eventually get rid of it by pooping.   \n",
       "18                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            It can, and is, all the time.  Do you ever wash your dishes?  Wash a pan you cooked with?  When you do that, you use dish soap, and then the soap helps break down the oils, and washes down the drain.    If you've ever worked on a car and got your hands all greasy, then you go inside and you use hot water and soap and you wash your hands really good, all those oils go down your drain.  Where you run into problems, is when people pour oil and grease down their drain.  Because it's not diluted enough, and it will then solidify in your pipes and cause them to clog.  Then you pay big bucks to have it fixed.   \n",
       "21                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    I worked at Mostek in the 70s and 80s and we reverse engineered the 8086 and 68000 families.  Our RAM and calculator chips were copied by many others. There was no law against it as copyright only covered the aesthetics and not function.  Congress passed a law allowing copyright of photomask's and that ended it.   \n",
       "23                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       What 59179 said, but also because it is so widespread and in common usage, trying to limit it outright could lead to huge backlash (think prohibition). The good news is they're slowly phasing it out though, and finally getting more and more regulations in place.   \n",
       "\n",
       "    labels  score_ratio  llm_score_A  llm_score_B  llm_pref  human_llm_match  \\\n",
       "3        1   189.600000          6.0          9.0       0.0            False   \n",
       "6        0     3.800000          8.5          7.0       1.0            False   \n",
       "8        0     2.200000          8.5          5.5       1.0            False   \n",
       "11       0     4.890411          5.0          5.0       0.5            False   \n",
       "15       1     7.786942          6.5          9.0       0.0            False   \n",
       "17       1     2.500000          7.5          9.0       0.0            False   \n",
       "18       1     7.111111          5.5          8.5       0.0            False   \n",
       "21       0     2.000000          8.5          4.5       1.0            False   \n",
       "23       1    12.333333          6.0          8.0       0.0            False   \n",
       "\n",
       "    spec_score_A  spec_score_B  spec_pref  human_spec_match  \n",
       "3       0.506020      0.426907          1              True  \n",
       "6       0.544800      0.826140          0              True  \n",
       "8       0.513261      0.558839          0              True  \n",
       "11      0.486942      0.594562          0              True  \n",
       "15      0.500565      0.448071          1              True  \n",
       "17      0.445564      0.423027          1              True  \n",
       "18      0.586834      0.432945          1              True  \n",
       "21      0.454712      0.661681          0              True  \n",
       "23      0.691250      0.443299          1              True  "
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "full_scores[full_scores.human_spec_match == True][full_scores.human_llm_match == False]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "id": "bYMuav-WT0BN"
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "colab": {
   "provenance": []
  },
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
